package com.mall.shop.web;

import com.mall.shop.service.SkuInfoService;
import com.mall.shop.utils.R;
import com.mall.shop.vo.product.SkuItemVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/item")
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;

    /**
     * 获取当前sku详细信息
     * @param skuId 商品ID
     * @return 商品信息封装对象
     */
    @GetMapping("/{skuId}.html")
    public R<SkuItemVO> getSkuItem(@PathVariable Long skuId) {
        SkuItemVO skuItemVO = skuInfoService.getSkuItem(skuId);
        return R.ok(skuItemVO);
    }
}
